package com.pengtu.service.project;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.pengtu.dao.QueryFilter;
import com.pengtu.dao.project.RelationshipDao;
import com.pengtu.entity.project.Relationship;

@Component
@Transactional
public class RelationshipManager {

	private RelationshipDao relationshipDao;

	// 操作relationship
	public void saveRelationship(Relationship relationship) {
		relationshipDao.save(relationship);
	}

	public void deleteRelationship(String id) {
		relationshipDao.delete(id);
	}

	@Transactional(readOnly = true)
	public Relationship findByPropertyName(String propertyName, String value) {
		return relationshipDao.findUniqueBy(propertyName, value);
	}

	@Transactional(readOnly = true)
	public List<Relationship> findByListRelationship(QueryFilter queryFilter) {
		return relationshipDao.find(queryFilter);
	}

	@Autowired
	public void setRelationshipDao(RelationshipDao relationshipDao) {
		this.relationshipDao = relationshipDao;
	}

}
